package com.sk.bilibili.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 邵康
 * @date 2021/11/18 20:15
 */
@Component
public class BiliBiliMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        setFieldValByName("createDate",new Date().getTime(),metaObject);
        setFieldValByName("updateDate",new Date().getTime(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        setFieldValByName("updateDate",new Date().getTime(),metaObject);
    }

}
